Read the data from the database
library(RMySQL)
## Warning: package 'RMySQL' was built under R version 3.2.3
## Loading required package: DBI
## Warning: package 'DBI' was built under R version 3.2.3
mydb = dbConnect(MySQL(), user='root', password='', dbname='pgs', host='localhost')
turbineData <- dbGetQuery(mydb, "Select * from turbineData order by timestamp")
## Warning in .local(conn, statement, ...): Decimal MySQL column 2 imported as
## numeric
## Warning in .local(conn, statement, ...): Decimal MySQL column 3 imported as
## numeric
## Warning in .local(conn, statement, ...): Decimal MySQL column 4 imported as
## numeric
## Warning in .local(conn, statement, ...): Decimal MySQL column 5 imported as
## numeric
## Warning in .local(conn, statement, ...): Decimal MySQL column 6 imported as
## numeric
str(turbineData)
## 'data.frame': 474467 obs. of 7 variables:
## $ timestamp : chr "2015-06-01 00:00:00" "2015-06-01 00:00:00" "2015-06-01 00:00:00" "2015-06-01 00:00:00" ...
## $ turbineId : chr "WTG011" "WTG012" "WTG010" "WTG031" ...
## $ power : num 0.81 0 16.62 0 108.83 ...
## $ windspeed : num 3.56 3.02 3.64 4.32 4.6 4.89 4.02 4.55 4.92 3.64 ...
## $ nacelle : num 196 204 177 232 172 ...
## $ temperature : num 23.6 23.4 23.5 25 24.1 ...
## $ operatingState: num 99.9 99.9 99.9 99.9 16 16 16 99.9 16 99.9 ...
curveIndexes1<-seq(from=1,to=9,by=1)
#curveIndexes2<-c(10:20,22,23,25:28,31,34,38,40:43,45:52,55,56)
curveIndexes2<-seq(from=10,to=56,by=1)
curveIndexesCombined=c(paste0("WTG00",1:9),paste0("WTG0",10:20),"WTG022","WTG023",
paste0("WTG0",25:28),"WTG031","WTG034","WTG038",paste0("WTG0",40:43),
paste0("WTG0",45:48),"WTG050","WTG051","WTG052","WTG055","WTG056")
p1=paste0("WTG00",curveIndexes1)
p2=paste0("WTG0",curveIndexes2)
curveIndexes=c(p1,p2)
curveIndexes1=as.factor(curveIndexes)
curveIndexes1=curveIndexes
numberOfTurbines=length(curveIndexesCombined)
curveNames=curveIndexesCombined
Define the function to get the compass directions
getCompassDirection=function(heading){
if (is.na(heading))
NA
if(heading>348.75 & heading <360.1)
"N"
else if(heading>=0 & heading <11.25)
"N"
else if(heading>11.25 & heading <33.75)
"NNE"
else if(heading>33.75 & heading <56.25)
"NE"
else if(heading>56.25 & heading <78.75)
"ENE"
else if(heading>78.75 & heading <101.25)
"E"
else if(heading>101.25 & heading <123.75)
"ESE"
else if(heading>123.75 & heading <146.25)
"SE"
else if(heading>146.25 & heading <168.75)
"SSE"
else if(heading>168.75 & heading <191.25)
"S"
else if(heading>191.25 & heading <213.75)
"SSW"
else if(heading>213.75 & heading <236.25)
"SW"
else if(heading>236.25 & heading <258.75)
"WSW"
else if(heading>258.75 & heading <281.25)
"W"
else if(heading>281.25 & heading <303.75)
"WNW"
else if(heading>303.75 & heading <326.25)
"NW"
else if(heading>326.25 & heading <348.75)
"NNW"
}
meanDirection=function(x)
{
#names(sort(table(x),decreasing = TRUE))[1]
sort(table(x),decreasing = TRUE)
}
changingDirection=function(x)
{
ll=length(names(sort(table(x))))
ss=sum(table(x))
as.character(c(ll,":",ss))
}
countUniqueDirections=function(x)
{
ll=length(names(sort(table(x))))
return(ll);
}
countNumberOfReadings=function(x)
{
ss=sum(table(x))
return(ss)
}
myMean=function(x)
{
ss=sum(table(x))
#return(ll);
return(sum(x)/ss)
}
findMeanDirection=function(x,monthName)
{
#i think the mean diraction can be found by first c
#first get the nascelle disrtibuted by months
nacelleMon=subset(x$nacelle,x$month==monthName)
directions=sapply(nacelleMon,getCompassDirection)
directions=unlist(directions)
sort(table(directions),decreasing = TRUE)
}
df=turbineData
df$compassDirection=lapply(df$nacelle,getCompassDirection)
#df$compassDirection=unlist(df$compassDirection)
tt<-as.Date(df$timestamp)
df$days=as.factor(format(tt,'%d_%b'))
df$month=as.factor(format(tt,'%b'))
newOrder=unique(format(tt,'%d'))
#months=unique(df$month)
months=c("Sep","Aug","Jul","Jun")
colors=c("red","green","blue","yellow")
library(plotrix)
## Warning: package 'plotrix' was built under R version 3.2.3
#newfactors1=paste0(newOrder[1:30],"_",months[1])
#newfactors2=paste0(newOrder[1:31],"_",months[2])
#newfactors=c(newfactors1,newfactors2)
#df$days = factor(df$days,levels(x)[c(4,5,1:3)])
#draw power plots of this turbine
for(i in c(1:numberOfTurbines)){
#i=1
#individualTurbineData=df
individualTurbineData=subset(df,df$turbineId==curveIndexesCombined[i])
unsortedPowerByDay=by(individualTurbineData$power,individualTurbineData$days,sum)
#sortedPowerByDayJul=unsortedPowerByDay[seq(1,61,2)]
#sortedPowerByDayJun=unsortedPowerByDay[seq(2,61,2)]
#sortedPowerByDay=c(sortedPowerByDayJul,sortedPowerByDayJun)
#library(ggplot2)
barplot(unsortedPowerByDay,main = paste0("power curve for ",curveNames[i]),col=colors,legend=months,beside=TRUE)
#qplot(factor(months), data=unsortedPowerByDay, geom="bar", fill=factor(months))
#ggplot(unsortedPowerByDay, aes(factor(months)))
unsortedAvgPowerByDay=by(individualTurbineData$power,individualTurbineData$days,mean)
barplot(unsortedAvgPowerByDay,main = paste0("Avg power curve for ",curveNames[i]),col=colors)
#individualTurbineData$compassDirection=as.factor(individualTurbineData$compassDirection)
#similarly for the wind speed
unsortedAverageWindSpeedByDay=by(individualTurbineData$windspeed,individualTurbineData$days,myMean)
barplot(unsortedAverageWindSpeedByDay,main = paste0("wind curve for ",curveNames[i]),col=colors)
#monthly
monthlyPowerProduced=tapply(individualTurbineData$power,individualTurbineData$month,sum)
monthlyAvgWindSpeed=tapply(individualTurbineData$windspeed,individualTurbineData$month,myMean)
monthlyAvgNascellePosition=tapply(individualTurbineData$nacelle, individualTurbineData$month,mean)
#monthlyCompassDirection=sapply(monthlyAvgNascellePosition,getCompassDirection)
monthMat=data.frame(matrix(ncol=3,nrow=length(months)))
monthMat[,1]=monthlyPowerProduced
monthMat[,2]=monthlyAvgWindSpeed
monthMat[,3]=monthlyAvgNascellePosition
#monthMat[,4]=monthlyCompassDirection
rownames(monthMat)=names(monthlyPowerProduced)
colnames(monthMat)=c("Total Power","Avg Wind Speed","Avg Nascelle")
print(monthMat)
#direction distributions
# windDirectionperDay=by(individualTurbineData$compassDirection,individualTurbineData$day#s,meanDirection)
#plot(individualTurbineData$days,individualTurbineData$power,main=curveIndexesCombined[i])
#plot(individualTurbineData$days,individualTurbineData$power,main=curveIndexesCombined[i],type='l')
for(j in c(1:length(months))){
#subsetDataForJune=subset(individualTurbineData,individualTurbineData$month=="Jun")
#subsetDataForJuly=subset(individualTurbineData,individualTurbineData$month=="Jul")
directions=findMeanDirection(individualTurbineData,months[j])
cat("Directions for the month",months[j])
print(directions)
subsetData=subset(individualTurbineData,individualTurbineData$month==months[j])
spread=max(subsetData$nacelle)-min(subsetData$nacelle)
label=paste(curveNames[i],"for month",months[j],spread)
polar.plot(subsetData$windspeed,polar.pos=subsetData$nacelle,
start=90,clockwise=TRUE,rp.type="s",
point.symbols=19,boxed.radial=FALSE,
radial.labels="",main = label,lwd=2,line.col=4)
#polar.plot(subsetDataForJuly$windspeed,polar.pos=subsetDataForJuly$nacelle,
# start=90,clockwise=TRUE,rp.type="s",
# point.symbols=19,boxed.radial=FALSE,
# radial.labels="",main = label,lwd=2,line.col=3)
}
}
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1974507.8 8.197581 120.29988
## Jul 3597572.7 11.020665 102.23983
## Jun 1754829.5 10.311637 95.89056
## Sep 850436.4 6.153893 131.56814
## Directions for the month Sepdirections
## SSE SE ESE E ENE S WSW SW SSW WNW N NW W NNE NNW NE
## 663 565 486 373 107 54 32 31 23 13 11 10 8 7 6 5
## Directions for the month Augdirections
## ESE SE E SSE N S ENE
## 1571 932 154 103 7 4 3
## Directions for the month Juldirections
## ESE E SE ENE N NE NNE
## 1500 1280 89 48 8 4 3
## Directions for the month Jundirections
## E ENE ESE NE SE N NNE WNW W NNW WSW NW SW S SSE
## 1062 690 359 133 84 50 45 33 23 20 19 17 13 5 4
## SSW
## 2
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1648560 7.001056 294.2230
## Jul 3232302 9.473479 284.4907
## Jun 2014008 8.893378 235.6467
## Sep 829988 5.587456 282.0234
## Directions for the month Sepdirections
## NW WNW W WSW NNW N NE ENE NNE E ESE S SE SSE SSW SW
## 829 514 339 321 214 33 27 26 26 16 12 11 9 7 5 4
## Directions for the month Augdirections
## WNW NW W NNW WSW N S SSW SW
## 1783 578 360 30 13 6 1 1 1
## Directions for the month Juldirections
## WNW W NW N WSW SSW S ESE NNW
## 1616 1098 191 12 10 7 2 1 1
## Directions for the month Jundirections
## W WNW WSW NNE NW NE ENE SW SSW S ESE E NNW SE SSE
## 1270 502 289 179 148 93 83 70 45 42 34 32 29 27 23
## N
## 14
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1709571.7 7.054780 72.70018
## Jul 3084005.1 9.485749 178.43267
## Jun 1813594.9 9.301578 258.80832
## Sep 782684.1 5.340694 122.40654
## Directions for the month Sepdirections
## NNE NE N NNW NW ENE SE ESE E SSW WSW S SW SSE WNW W
## 718 523 451 276 180 42 42 40 34 19 16 13 10 9 9 7
## Directions for the month Augdirections
## NNE N NNW NE WSW ESE ENE NW SW SE SSW
## 1233 1223 121 105 45 29 6 5 3 2 1
## Directions for the month Juldirections
## N NNW NNE WSW ESE SE SW NE NW
## 1580 548 466 159 147 16 14 2 2
## Directions for the month Jundirections
## NNW N NW NNE WSW ESE WNW NE W SW SSW SE SSE S E
## 1154 638 315 239 92 81 75 55 40 36 33 30 30 21 15
## ENE
## 9
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1717932.4 7.769158e+00 295.5930
## Jul 2450977.6 1.011204e+01 316.1235
## Jun 0.0 5.888651e-05 319.1273
## Sep 642240.5 5.706233e+00 164.7670
## Directions for the month Sepdirections
## NNE N NW NNW WNW NE ESE WSW ENE SE S SW E SSE SSW W
## 827 560 354 352 102 58 48 15 14 14 13 10 9 9 7 6
## Directions for the month Augdirections
## NNW N NW NNE WSW ESE SW NE WNW SE
## 1402 1056 187 68 20 16 6 5 2 1
## Directions for the month Juldirections
## NNW NW N WSW ESE W WNW SW S SSW NNE E SE
## 1271 656 254 171 30 17 9 7 5 4 2 1 1
## Directions for the month Jundirections
## NW N SW ESE
## 1847 13 5 3
## Total Power Avg Wind Speed Avg Nascelle
## Aug 2155341.5 8.106676 108.44177
## Jul 3709493.2 10.482168 99.83716
## Jun 1400648.6 8.584583 102.94506
## Sep 752747.6 5.662781 117.45581
## Directions for the month Sepdirections
## ESE SE E ENE SSE WSW SW SSW NW WNW W NNW S N NE
## 1265 446 373 170 32 27 22 15 14 10 8 7 6 4 3
## NNE
## 1
## Directions for the month Augdirections
## ESE E SE ENE N SSE
## 2088 561 111 10 1 1
## Directions for the month Juldirections
## E ESE ENE SE N NE NNE
## 1523 1370 28 11 4 1 1
## Directions for the month Jundirections
## E ESE ENE NE SE NNE WNW WSW N NNW NW SW W SSW S
## 1275 634 459 110 64 46 32 32 30 30 30 28 27 15 8
## SSE
## 7
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1855713.3 8.001846 266.2944
## Jul 3433407.9 9.560218 252.5550
## Jun 1669705.1 8.478699 229.5756
## Sep 727593.2 5.935141 260.4150
## Directions for the month Sepdirections
## W WNW WSW SW NW SSW NNE NE N NNW ESE E ENE SE SSE S
## 821 779 329 281 39 35 28 23 17 13 12 10 6 6 5 2
## Directions for the month Augdirections
## W WSW WNW SW N NW S
## 1774 653 304 31 5 3 3
## Directions for the month Juldirections
## WSW W SW WNW N E S SSE
## 1726 1005 177 15 8 3 3 1
## Directions for the month Jundirections
## WSW SW W SSW WNW S SSE E SE ESE NE ENE N NNE NW NNW
## 962 766 429 158 98 52 48 41 36 31 31 21 20 12 8 7
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1521516.8 7.101637 85.25042
## Jul 3246423.3 9.983829 73.70935
## Jun 1837464.5 9.547917 77.23521
## Sep 653551.1 5.432980 93.91035
## Directions for the month Sepdirections
## ESE E ENE NE SE NNE SSW SSE S SW WSW W N NNW NW WNW
## 692 679 387 375 66 34 29 27 26 17 14 12 9 8 7 6
## Directions for the month Augdirections
## E ENE ESE NE SE N SSE
## 1663 790 233 53 23 9 1
## Directions for the month Juldirections
## ENE E NE N ESE NNE
## 1814 980 112 15 13 3
## Directions for the month Jundirections
## NE ENE E NNE ESE NNW SSW NW SW WSW WNW W N S SE
## 1123 860 301 199 104 45 35 33 33 29 26 24 22 20 11
## SSE
## 10
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1224278.2 6.299041 291.0186
## Jul 2755954.3 8.974117 275.5958
## Jun 1484213.1 8.270460 244.2807
## Sep 371280.9 4.154145 283.1645
## Directions for the month Sepdirections
## NW WNW WSW W NNW SW N NE ENE NNE SE S SSW ESE SSE E
## 803 618 285 282 183 112 28 25 19 13 10 6 6 5 4 2
## Directions for the month Augdirections
## WNW W NW NNW WSW N SSW S SSE SW
## 1988 408 278 44 40 6 3 2 1 1
## Directions for the month Juldirections
## W WNW WSW NW ENE E SW SSE SSW N S
## 1634 1063 204 24 8 3 3 2 2 1 1
## Directions for the month Jundirections
## WSW W SW WNW SSW NW S SSE E SE ESE NE ENE NNW NNE N
## 935 746 395 289 117 103 63 49 30 28 26 22 19 19 14 11
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1073116.8 5.995779 295.1781
## Jul 2291400.9 7.922227 287.6826
## Jun 1435758.6 6.911572 259.3429
## Sep 288828.2 4.178213 282.7189
## Directions for the month Sepdirections
## NW WNW W NNW WSW SW N NE NNE ENE E SSW S SSE SE ESE
## 790 541 269 255 236 148 49 34 20 17 12 9 8 7 6 4
## Directions for the month Augdirections
## WNW NW W NNW WSW N ESE SSW
## 1631 696 343 59 38 2 1 1
## Directions for the month Juldirections
## WNW W NW WSW E N NNW S
## 1689 893 334 23 2 1 1 1
## Directions for the month Jundirections
## W WSW WNW NW SW NNW SSW S SSE ESE ENE SE E NE N
## 1048 559 538 198 134 82 82 60 41 33 22 22 18 16 13
## NNE
## 8
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1335178.3 6.563745 274.8200
## Jul 2781964.1 8.852800 265.0057
## Jun 1371117.5 7.016643 234.4912
## Sep 308105.9 4.233836 265.2459
## Directions for the month Sepdirections
## WNW W SW NW WSW SSW NNE NNW NE N S SSE ESE SE E ENE
## 804 639 282 240 228 75 37 31 25 15 7 7 6 6 3 1
## Directions for the month Augdirections
## W WNW WSW NW SW NNW N S
## 1679 762 246 54 26 4 2 1
## Directions for the month Juldirections
## W WSW WNW SW E N NW SSE
## 1800 864 252 25 1 1 1 1
## Directions for the month Jundirections
## WSW SW W WNW SSW S SSE SE NW E NE ENE ESE N NNE NNW
## 950 660 625 147 124 89 59 42 31 30 29 24 21 18 14 7
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1492851.2 7.066781 282.2440
## Jul 3257449.4 9.918985 269.6267
## Jun 1521503.6 7.473213 248.3433
## Sep 330217.6 4.389788 279.0373
## Directions for the month Sepdirections
## WNW NW W WSW SW NNW NE ENE N NNE SSW SE S SSE E ESE
## 815 599 378 270 113 107 33 17 17 17 11 9 7 5 4 4
## Directions for the month Augdirections
## W WNW WSW NW N NNW S SW
## 1384 1297 52 36 1 1 1 1
## Directions for the month Juldirections
## W WSW WNW SW NW E N SSE
## 1990 486 460 4 2 1 1 1
## Directions for the month Jundirections
## WSW W WNW SW NW SSW S SSE ENE SE ESE E NE NNW N NNE
## 944 920 323 219 104 98 58 44 34 31 24 23 20 15 10 9
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1550252.2 6.882592 285.0137
## Jul 3552328.5 10.307770 279.7223
## Jun 1749737.0 7.991657 255.0386
## Sep 394303.4 4.233608 274.8205
## Directions for the month Sepdirections
## WNW W NW WSW SW NNW NE N ENE NNE SE SSE SSW S ESE E
## 811 513 480 292 117 71 32 23 19 15 11 6 6 4 3 2
## Directions for the month Augdirections
## WNW W NW WSW NNW N SSW
## 1737 837 101 73 20 1 1
## Directions for the month Juldirections
## W WNW WSW NW E N S
## 1520 1332 73 14 2 1 1
## Directions for the month Jundirections
## W WSW WNW SW NW SSW S ENE SSE E SE ESE NNW NE N
## 1233 657 435 116 110 78 52 36 32 27 27 20 16 14 11
## NNE
## 6
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1367038.1 6.632127 32.06550
## Jul 3357743.6 9.946687 266.04970
## Jun 1815871.6 7.999248 276.63796
## Sep 351179.5 4.299492 88.25167
## Directions for the month Sepdirections
## NNE NE N ENE NNW SSE NW E ESE WSW SE S SW W WNW SSW
## 737 665 343 319 149 33 27 25 24 23 21 17 8 5 5 1
## Directions for the month Augdirections
## NNE N NE ENE NNW WSW ESE E SE
## 1854 616 223 46 13 10 6 3 3
## Directions for the month Juldirections
## N NNW ESE WSW NNE SE SW NW
## 1508 942 196 140 93 22 20 11
## Directions for the month Jundirections
## NNW N NW WSW NNE W WNW S SSE ESE SSW NE SW SE ENE
## 1231 384 300 282 99 99 75 69 59 54 51 50 46 39 20
## E
## 14
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1407123.6 6.853472 60.17767
## Jul 3167545.0 9.543506 43.11085
## Jun 1515428.1 7.983834 82.97085
## Sep 344074.6 4.643820 71.89932
## Directions for the month Sepdirections
## ENE E NE NNE ESE N S SSW SE SSE W NW WSW NNW WNW SW
## 769 570 549 276 69 43 31 22 20 19 10 7 7 6 4 3
## Directions for the month Augdirections
## ENE NE E NNE ESE N SE
## 1702 855 133 49 12 6 3
## Directions for the month Juldirections
## NE NNE ENE E N
## 2096 586 253 4 2
## Directions for the month Jundirections
## NNE NE N ENE WNW S SW WSW NW SSW W NNW E ESE SSE
## 1186 450 222 119 109 107 76 65 61 60 48 45 38 29 28
## SE
## 27
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1345657.1 6.633001 270.1753
## Jul 3043317.3 9.312890 257.7378
## Jun 1653885.4 7.589532 232.4765
## Sep 343980.5 4.386201 261.6548
## Directions for the month Sepdirections
## W WNW WSW SW NW SSW NE NNE NNW N ENE SSE ESE SE E S
## 760 679 393 216 163 66 32 20 20 18 10 7 6 6 5 5
## Directions for the month Augdirections
## W WSW WNW NW N SW E NNW S
## 1915 398 392 40 9 6 2 2 1
## Directions for the month Juldirections
## WSW W SW WNW N SSE E
## 1444 1402 51 33 2 2 1
## Directions for the month Jundirections
## WSW SW W SSW WNW S SSE SE ENE NE NW E ESE N NNE
## 1257 689 370 118 96 76 44 39 36 30 25 19 18 13 9
## NNW
## 3
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1372087.7 6.835920 283.1410
## Jul 3107446.5 9.469063 278.7735
## Jun 1533385.7 7.735512 249.9717
## Sep 358022.5 4.592498 269.5025
## Directions for the month Sepdirections
## WNW W WSW NW SW NE NNW N ENE NNE SSW E ESE SE SSE S
## 804 643 377 323 102 36 30 16 15 15 10 9 8 7 6 5
## Directions for the month Augdirections
## WNW W NW WSW NNW N E ESE SSW
## 1444 1007 183 104 11 9 1 1 1
## Directions for the month Juldirections
## W WNW WSW NW N S
## 1602 1255 54 31 1 1
## Directions for the month Jundirections
## W WSW WNW SW NW SSW S ENE E SSE N SE ESE NNW NNE
## 1125 846 314 126 84 74 45 41 37 33 22 20 16 11 10
## NE
## 8
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1421839.8 6.910904 57.86521
## Jul 970541.3 9.538437 49.50716
## Jun 0.0 7.156966 100.05705
## Sep 381505.4 4.620919 67.45589
## Directions for the month Sepdirections
## ENE NE E NNE N ESE S SSW SE SSE WSW SW W NW NNW WNW
## 844 609 373 267 145 41 30 28 15 13 12 9 7 6 3 3
## Directions for the month Augdirections
## ENE NE E NNE ESE N
## 1446 1072 140 88 9 9
## Directions for the month Juldirections
## NE NNE ENE W NNW N WSW SSW ESE SE SSE WNW
## 786 177 77 18 8 5 4 2 1 1 1 1
## Directions for the month Jundirections
## E N ENE NNE SW SSE
## 1900 17 4 4 2 1
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1623165.0 7.399391 260.1874
## Jul 3091511.6 9.599571 252.0015
## Jun 1985893.6 9.051293 233.1703
## Sep 776112.9 5.889720 254.6286
## Directions for the month Sepdirections
## W WNW WSW SW SSW NW NNE NNW N NE E ENE SE ESE S SSE
## 745 597 425 373 56 43 34 29 28 21 11 7 7 5 5 5
## Directions for the month Augdirections
## W WSW WNW SW NW N S SSW
## 1392 1155 133 83 5 4 1 1
## Directions for the month Juldirections
## WSW W SW WNW N E S SSE ESE SE
## 1826 883 185 18 10 5 3 3 2 1
## Directions for the month Jundirections
## WSW SW W WNW SSW SSE S NE ENE ESE SE E N NW NNE
## 1029 926 394 141 112 50 36 35 27 26 21 20 17 17 16
## NNW
## 8
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1176482.6 6.374193 240.4619
## Jul 2914831.4 8.988639 234.7976
## Jun 1293219.2 7.897450 214.0541
## Sep 419404.6 4.639256 237.9732
## Directions for the month Sepdirections
## WSW W SW SSW WNW NNE S NW N NNW ENE NE E SE ESE SSE
## 771 698 406 286 82 47 28 19 18 16 8 8 6 6 4 3
## Directions for the month Augdirections
## WSW SW W SSW N WNW E NW SSE ENE
## 1745 714 235 29 15 12 4 3 3 1
## Directions for the month Juldirections
## SW WSW SSW W ENE N SE
## 1467 1318 104 53 1 1 1
## Directions for the month Jundirections
## SW SSW WSW W S SSE SE ESE NNE NE WNW ENE N E NNW
## 1296 489 473 123 110 65 45 33 32 31 30 26 24 15 9
## NW
## 7
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1028699.2 6.077220 275.7280
## Jul 2702467.5 8.722189 271.1682
## Jun 1420422.3 7.670485 250.9166
## Sep 325853.8 4.504929 269.0571
## Directions for the month Sepdirections
## WNW W WSW NW SW NE NNW ENE N E NNE SE ESE S SSE SSW
## 876 664 328 261 122 39 28 18 17 14 13 7 5 5 4 3
## Directions for the month Augdirections
## W WNW WSW NW N NNW E S SSW SW
## 1701 825 179 42 10 3 1 1 1 1
## Directions for the month Juldirections
## W WNW WSW NW E ESE N SSE SW
## 1899 621 402 19 1 1 1 1 1
## Directions for the month Jundirections
## W WSW WNW SW NW SSW S E ENE SSE N SE ESE NE NNE
## 1255 610 344 129 97 60 40 39 36 32 26 24 15 14 11
## NNW
## 8
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1630655.8 6.813567 264.3081
## Jul 3261434.7 9.324895 256.3416
## Jun 1348421.2 8.037091 233.5552
## Sep 629137.5 4.937228 258.1964
## Directions for the month Sepdirections
## WNW W WSW SW SSW NW NNE NNW ESE NE E N ENE S SE SSE
## 827 608 335 316 133 65 29 18 16 14 11 10 9 5 5 5
## Directions for the month Augdirections
## W WSW WNW SW NW N S E SSW
## 1743 707 216 82 13 5 2 1 1
## Directions for the month Juldirections
## WSW W SW WNW E N NW SSE SSW
## 1558 1235 98 46 3 3 1 1 1
## Directions for the month Jundirections
## SW WSW W WNW SE SSW E N NW S NNE SSE ESE NE ENE
## 1038 877 380 153 64 48 28 23 21 21 19 17 12 11 8
## NNW
## 2
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1594649.3 7.293303 186.6634
## Jul 2970765.4 9.359823 258.2293
## Jun 1439731.6 8.598541 240.4867
## Sep 638937.2 5.544314 107.5058
## Directions for the month Sepdirections
## ESE SE E ENE NE SW SSE WNW SSW S WSW NNE NNW NW W N
## 810 493 416 280 255 33 23 22 15 11 10 9 8 7 7 3
## Directions for the month Augdirections
## W ESE WSW E ENE SE WNW SW N NE NNW SSE S SSW
## 880 614 517 464 120 83 49 21 6 4 3 3 2 1
## Directions for the month Juldirections
## WSW W SW WNW E ESE N SSE SSW
## 1366 1252 167 156 1 1 1 1 1
## Directions for the month Jundirections
## WSW SW W WNW NW N S SSW NNE E ESE SSE SE NE NNW ENE
## 896 834 494 205 61 26 23 19 17 15 13 13 12 5 4 1
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1527296.0 7.339488 202.3553
## Jul 2931127.7 9.413795 194.4240
## Jun 1624019.8 8.285562 183.7639
## Sep 468528.2 5.175923 205.7431
## Directions for the month Sepdirections
## SW SSW SSE S WSW SE NNW NW W WNW NNE NE ENE ESE E N
## 893 627 291 269 157 53 24 20 20 13 12 9 6 4 3 3
## Directions for the month Augdirections
## SSW S SW WSW SSE N SE E ENE NW W WNW
## 2044 335 317 33 32 4 3 1 1 1 1 1
## Directions for the month Juldirections
## SSW S SW SSE N ENE SE E ESE
## 1555 1057 257 58 6 5 2 1 1
## Directions for the month Jundirections
## S SSW SW SSE SE WSW ESE E ENE NE NNE W N NNW WNW
## 1099 687 325 297 96 94 64 39 32 30 30 18 17 17 14
## NW
## 5
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1603353.7 7.303378 305.9536
## Jul 3253246.0 9.942094 293.4881
## Jun 1576681.0 8.119082 265.0427
## Sep 465882.2 4.958333 296.1145
## Directions for the month Sepdirections
## NW NNW WNW W WSW N ENE S E NNE NE SSW SW ESE SE SSE
## 804 635 359 273 148 53 24 18 16 16 13 13 12 10 5 5
## Directions for the month Augdirections
## NW WNW NNW W N SSW ESE SW WSW
## 1556 1017 118 69 7 2 1 1 1
## Directions for the month Juldirections
## WNW NW W WSW E N NNW S SSW
## 1848 677 410 3 2 2 2 1 1
## Directions for the month Jundirections
## W WNW WSW NW SW SSW NNW S E SSE ESE SE ENE N NE NNE
## 930 921 317 253 85 77 60 52 30 30 29 24 17 17 12 10
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1658579.9 7.049340 134.3092
## Jul 3398924.2 10.082682 113.8848
## Jun 1634517.7 8.854997 109.1455
## Sep 506540.4 4.836904 144.1818
## Directions for the month Sepdirections
## SSE SE ESE S E W ENE SSW SW WSW NNW N NNE NW WNW NE
## 810 669 283 255 249 28 22 21 17 13 12 7 6 5 5 4
## Directions for the month Augdirections
## SE ESE SSE S E N
## 1905 445 359 36 17 9
## Directions for the month Juldirections
## ESE SE E SSE ENE N NE
## 1972 611 356 3 2 1 1
## Directions for the month Jundirections
## E ESE SE ENE NE SSE NNE N NNW NW SW W WSW WNW S SSW
## 993 870 290 256 108 78 59 40 30 29 24 23 22 19 13 10
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1378568.7 6.203057 310.5373
## Jul 3114801.4 6.647054 287.4685
## Jun 1637041.1 9.144888 256.6363
## Sep 423812.9 5.193396 300.3367
## Directions for the month Sepdirections
## NNW NW WNW W N WSW ENE NNE E S NE SSE SSW ESE SW SE
## 830 677 309 269 116 86 24 23 21 11 9 9 7 6 5 3
## Directions for the month Augdirections
## NW WNW NNW W N SSW SW WSW NE NNE S SE SSE
## 1764 664 270 35 20 7 4 4 1 1 1 1 1
## Directions for the month Juldirections
## WNW W NW WSW E N NNE NNW S SSW
## 1820 854 252 12 2 1 1 1 1 1
## Directions for the month Jundirections
## W WSW WNW NW SW SSW S NNW SSE ENE ESE SE E N NE
## 1013 603 588 159 120 92 58 39 39 31 31 31 21 16 15
## NNE
## 10
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1601842.5 6.923673 285.5225
## Jul 2751185.1 8.579735 276.2498
## Jun 1531568.6 7.809458 252.2649
## Sep 716347.6 5.369048 272.9613
## Directions for the month Sepdirections
## WNW NW W WSW SW NNW N NE NNE ESE ENE E SSE SE S SSW
## 700 675 375 321 76 64 39 38 32 16 15 11 10 9 7 3
## Directions for the month Augdirections
## WNW W NW WSW NNW N SSW SW
## 1576 937 181 60 13 2 2 1
## Directions for the month Juldirections
## W WNW WSW NW N S SSE E SSW
## 1660 1018 199 44 9 2 2 1 1
## Directions for the month Jundirections
## W WSW WNW NW SW SSW S SE ENE E NE NNE SSE ESE NNW
## 1077 831 384 140 125 46 45 35 27 26 26 26 25 24 13
## N
## 10
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1621028.8 7.033621 305.3047
## Jul 3320768.4 9.938771 320.9324
## Jun 1740616.7 9.204888 284.4458
## Sep 634316.9 5.226205 190.0189
## Directions for the month Sepdirections
## N NNE NNW NW WNW ESE NE S WSW E ENE SW SSE SE SSW W
## 670 559 427 406 157 43 34 19 16 15 13 13 9 8 8 8
## Directions for the month Augdirections
## NNW N NW NNE ESE WSW NE WNW SW
## 1588 833 234 79 15 7 5 5 3
## Directions for the month Juldirections
## NW NNW WNW N ESE SSW
## 1727 954 220 40 1 1
## Directions for the month Jundirections
## WNW NW W NNW N WSW SW SE SSE SSW ESE S E ENE NNE
## 1026 696 315 257 96 83 48 39 33 31 24 24 18 16 12
## NE
## 4
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1390770.6 6.726750 92.98664
## Jul 3149754.0 9.389579 85.25407
## Jun 1689572.0 8.067454 90.60852
## Sep 421391.6 4.741413 101.69212
## Directions for the month Sepdirections
## ESE E ENE NE SE SW SSW SSE WSW S W WNW N NNW NW NNE
## 853 743 337 181 150 32 21 18 18 14 10 9 5 5 5 2
## Directions for the month Augdirections
## E ESE ENE SE N NE SSE
## 1839 589 284 36 10 5 2
## Directions for the month Juldirections
## E ENE ESE NE SE N NNE
## 1843 897 194 5 3 1 1
## Directions for the month Jundirections
## ENE E ESE NE NNE SE WSW NNW N W WNW NW SW S SSE
## 1230 776 248 197 72 50 46 39 38 33 20 16 12 11 10
## SSW
## 9
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1245143.0 6.294870 321.4762
## Jul 2659959.6 8.386607 318.4851
## Jun 1783379.6 7.657260 289.1453
## Sep 470898.8 4.641240 288.3033
## Directions for the month Sepdirections
## NNW N NW WNW W ESE NNE E WSW NE ENE S SE SSE SW SSW
## 779 721 332 263 108 47 37 24 22 18 15 9 9 9 7 4
## Directions for the month Augdirections
## NNW NW N WNW ESE WSW SW SSW NNE W ENE SE SSE
## 1611 740 315 46 31 12 6 5 3 2 1 1 1
## Directions for the month Juldirections
## NW NNW WNW N ESE WSW SW SSW W E S SE
## 1566 1067 218 53 10 9 5 3 2 1 1 1
## Directions for the month Jundirections
## NW WNW NNW W N WSW ESE SSW SW SE SSE E S ENE NNE
## 1003 794 341 197 123 112 48 48 36 26 26 24 21 14 10
## NE
## 8
## Total Power Avg Wind Speed Avg Nascelle
## Aug 2120172.8 8.123661 274.0069
## Jul 3607548.2 10.433155 271.1262
## Jun 1734144.1 8.573431 254.8196
## Sep 757563.7 5.608731 264.8498
## Directions for the month Sepdirections
## WNW W WSW SW NW NE NNW ESE NNE N ENE E SE SSE SSW
## 1015 745 269 197 42 31 20 18 16 14 12 7 7 6 4
## S
## 1
## Directions for the month Augdirections
## W WNW WSW N NW SW E S SSW
## 1868 708 180 5 3 3 1 1 1
## Directions for the month Juldirections
## W WNW WSW N NW S E SW SSE
## 1782 761 365 15 5 4 2 2 1
## Directions for the month Jundirections
## W WSW WNW NW SW S SSW SE E ESE SSE ENE N NNE NE
## 1127 584 544 137 118 43 42 37 30 29 28 25 21 16 15
## NNW
## 7
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1981493.0 8.087495 61.64317
## Jul 3496010.9 10.760973 63.19821
## Jun 1733158.5 9.337917 96.97252
## Sep 783342.5 5.981152 72.14797
## Directions for the month Sepdirections
## ENE NE E N NNE ESE S SSE WSW SE SW SSW W WNW NNW
## 1179 421 260 200 164 43 30 20 19 15 13 12 12 8 5
## NW
## 3
## Directions for the month Augdirections
## ENE NE E NNE N ESE
## 1685 823 209 44 7 2
## Directions for the month Juldirections
## ENE NE E NNE N SE SSW WSW ESE
## 1533 919 438 26 11 4 2 2 1
## Directions for the month Jundirections
## ENE NE E NNE WSW ESE W SW NNW N NW SSW WNW S SE
## 1044 643 312 166 146 118 97 80 46 37 35 28 27 19 17
## SSE
## 12
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1120245.7 6.167845 301.1190
## Jul 2658345.2 8.645704 284.8241
## Jun 1346925.8 7.579810 246.6816
## Sep 452770.1 4.932909 293.0111
## Directions for the month Sepdirections
## NW WNW NNW W WSW N NNE ENE NE SSE SE E S SW ESE SSW
## 763 528 522 256 188 33 21 19 17 13 12 9 8 7 5 2
## Directions for the month Augdirections
## WNW NW W NNW N WSW E ESE SSW ENE SE
## 1472 1067 108 93 11 4 3 3 2 1 1
## Directions for the month Juldirections
## WNW W NW WSW N E SSW S
## 1823 920 169 15 7 3 3 2
## Directions for the month Jundirections
## W WNW SSE WSW NW SW NE NNW ESE N NNE E ENE SE S SSW
## 913 568 544 516 164 20 18 18 14 14 12 11 11 9 5 1
## Total Power Avg Wind Speed Avg Nascelle
## Aug 2189828.8 8.300880 319.2955
## Jul 3726908.1 11.042771 316.5212
## Jun 1745124.3 10.017780 284.7103
## Sep 879624.5 6.098865 253.6147
## Directions for the month Sepdirections
## N NNW NW WNW W NNE ESE NE E WSW ENE SSE SE S SSW SW
## 868 539 349 310 107 64 47 27 25 15 14 10 9 7 7 7
## Directions for the month Augdirections
## NNW NW N WNW NNE ESE SW WSW W SE
## 1533 802 306 87 21 9 6 6 2 1
## Directions for the month Juldirections
## NW NNW WNW N ESE SW SSW W E
## 1809 765 308 37 8 4 3 2 1
## Directions for the month Jundirections
## WNW NW W NNW WSW N SW SSW ESE SE E S SSE NE ENE NNE
## 992 588 308 216 103 55 52 43 28 25 24 15 13 11 8 4
## Total Power Avg Wind Speed Avg Nascelle
## Aug 2204588.2 8.789361 110.97297
## Jul 3772030.0 11.844401 93.40613
## Jun 1865394.8 10.397486 95.96128
## Sep 843271.2 6.313831 127.78216
## Directions for the month Sepdirections
## SE ESE SSE E ENE S WSW SW SSW W WNW NNW NW N NE NNE
## 945 497 328 260 234 27 26 20 17 15 9 8 8 5 3 1
## Directions for the month Augdirections
## ESE E SE ENE SSE N
## 1705 572 466 13 7 6
## Directions for the month Juldirections
## E ESE ENE SE N NNE NE
## 1952 712 237 20 10 4 1
## Directions for the month Jundirections
## ENE E ESE NE SE NNE NNW N W WSW SW NW WNW SSW S SSE
## 942 930 333 208 88 77 49 32 31 31 29 22 20 14 10 8
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1996604.8 8.090069 282.9977
## Jul 3473194.3 10.609823 277.8000
## Jun 1554622.6 9.065089 261.0509
## Sep 697393.5 5.755383 273.7459
## Directions for the month Sepdirections
## WNW NW W SW WSW NNW NE N NNE ENE E ESE SSE S SE SSW
## 831 548 468 244 153 29 25 19 19 18 13 13 9 3 3 3
## Directions for the month Augdirections
## WNW W NW WSW N SSW SW NNW
## 1414 1111 164 69 6 2 2 1
## Directions for the month Juldirections
## W WNW WSW NW N E S SSW
## 1659 1123 84 52 10 4 3 1
## Directions for the month Jundirections
## W WNW WSW NW SW S NNW SSW E ENE ESE SE SSE N NE
## 1119 571 461 238 111 51 43 41 28 27 27 25 22 17 16
## NNE
## 10
## Total Power Avg Wind Speed Avg Nascelle
## Aug 2093492.5 8.573814 288.8859
## Jul 3698777.1 11.564506 279.8700
## Jun 1759949.1 8.052574 250.9617
## Sep 783659.8 5.963552 283.5806
## Directions for the month Sepdirections
## NW WNW W WSW NNW N NE ENE NNE SW SE E SSE ESE SSW
## 1036 614 303 259 42 27 24 20 16 16 12 11 10 9 3
## S
## 2
## Directions for the month Augdirections
## WNW W NW WSW N NNW SSW
## 1805 631 303 21 3 2 1
## Directions for the month Juldirections
## W WNW NW WSW N E S SSW
## 1467 1314 96 41 12 3 3 1
## Directions for the month Jundirections
## W WSW WNW NW SW SSW NE S SSE E ESE ENE SE NNE N
## 1331 497 381 132 113 83 53 41 40 33 30 24 23 16 15
## NNW
## 12
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1463651.2 7.223937 318.4729
## Jul 2961793.7 9.920498 300.5106
## Jun 1671683.9 8.115765 266.9886
## Sep 366084.6 4.628612 281.1412
## Directions for the month Sepdirections
## NNW NW WNW N W E ESE NNE SW ENE WSW SE SSE SSW NE S
## 739 529 451 427 58 32 25 24 19 15 15 14 13 13 10 8
## Directions for the month Augdirections
## NW NNW WNW N NNE ESE W SW WSW
## 1726 817 152 52 7 5 4 2 1
## Directions for the month Juldirections
## WNW NW W N NNW SSW E ESE S SW
## 1476 1372 40 17 10 4 2 2 2 1
## Directions for the month Jundirections
## W WNW NW WSW SW ESE SE S NNW E SSE SSW NE ENE NNE
## 1100 973 242 221 60 49 42 41 34 24 23 23 20 11 8
## N
## 3
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1732956.4 7.276273 295.8627
## Jul 3421938.7 9.931942 324.8296
## Jun 1951783.9 8.137646 290.7047
## Sep 594245.4 5.099678 189.8122
## Directions for the month Sepdirections
## N NNE NNW NW WNW ESE NE WSW SE ENE S SSW SW E SSE W
## 680 662 417 397 56 36 32 20 14 13 13 12 12 11 8 7
## Directions for the month Augdirections
## NNW N NNE NW WSW ESE NE SW SE WNW
## 1323 1181 111 91 24 19 9 9 6 1
## Directions for the month Juldirections
## NNW NW N WNW ESE SW SSW
## 1496 1333 58 30 8 3 1
## Directions for the month Jundirections
## NW WNW NNW W N WSW SSW SE SSE S ESE SW ENE E NE NNE
## 999 936 350 214 80 53 43 40 35 34 31 18 15 12 10 6
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1688798.1 7.898544 176.8090
## Jul 3356308.9 10.693986 166.4867
## Jun 1700541.1 8.800630 157.7536
## Sep 653750.4 5.747588 183.7025
## Directions for the month Sepdirections
## SSW S SSE SE SW WSW WNW NW ESE ENE N W NNE NE NNW E
## 718 619 344 326 235 26 24 20 15 13 13 13 9 8 5 3
## Directions for the month Augdirections
## S SSE SSW SE SW N ESE NNW
## 1838 598 280 23 20 9 3 1
## Directions for the month Juldirections
## SSE S SE SSW N ESE ENE NE
## 1532 1324 48 14 6 2 1 1
## Directions for the month Jundirections
## SSE SE S ESE SSW E NNW SW ENE WNW NE NW W N NNE
## 1036 725 339 124 115 50 41 40 35 34 21 21 19 16 16
## WSW
## 16
## Total Power Avg Wind Speed Avg Nascelle
## Aug 2052178.8 8.056431 152.8731
## Jul 3774554.8 10.980437 145.3163
## Jun 2063721.0 10.022045 158.1079
## Sep 767190.1 5.992804 162.1845
## Directions for the month Sepdirections
## S SSE SE ESE SSW E SW W WNW WSW NW N NE NNW NNE ENE
## 847 508 358 345 141 37 29 27 27 21 12 9 8 8 7 2
## Directions for the month Augdirections
## SSE SE S ESE SSW N E
## 1562 816 322 38 23 11 1
## Directions for the month Juldirections
## SE SSE S ESE N E NE SSW W
## 1532 1078 187 109 12 4 2 1 1
## Directions for the month Jundirections
## SSE SE S ESE WNW SSW ENE NW E W NNW WSW NE NNE SW
## 1082 1027 269 143 115 77 39 30 26 17 16 11 10 6 6
## N
## 5
## Total Power Avg Wind Speed Avg Nascelle
## Aug 1819812.6 7.465418 267.4500
## Jul 3551594.3 10.228151 264.1622
## Jun 2249828.9 9.510000 247.9716
## Sep 811744.8 5.841165 260.1606
## Directions for the month Sepdirections
## WNW W SW WSW NW NNE NNW NE N ENE SSW SE E ESE SSE S
## 883 589 372 346 50 28 28 26 20 13 12 8 6 5 5 2
## Directions for the month Augdirections
## W WSW WNW SW NW N S SSW
## 1744 582 387 40 12 7 1 1
## Directions for the month Juldirections
## W WSW WNW N E SW S ESE NW SE SSE SSW
## 1745 811 347 11 10 8 3 2 1 1 1 1
## Directions for the month Jundirections
## WSW W WNW SW NW SSW S SSE ENE E NE SE ESE NNE NNW
## 1133 858 295 202 98 60 43 37 30 28 23 21 19 19 8
## N
## 5
Importnat thing to note is that in this case the nacelled is restricted to only one section
individualTurbineData=subset(df,df$turbineId==curveIndexesCombined[1])
train=individualTurbineData[1:1500,]
test=individualTurbineData[1501:2559,]
#need to relevel the factor variables
model1=lm(power~windspeed+nacelle,data=individualTurbineData)
summary(model1)
##
## Call:
## lm(formula = power ~ windspeed + nacelle, data = individualTurbineData)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2484.66 -183.66 -9.64 296.36 532.90
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -129.5724 18.6466 -6.949 3.9e-12 ***
## windspeed 101.3064 1.0793 93.864 < 2e-16 ***
## nacelle -0.1561 0.1105 -1.413 0.158
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 393.8 on 10658 degrees of freedom
## Multiple R-squared: 0.4884, Adjusted R-squared: 0.4884
## F-statistic: 5088 on 2 and 10658 DF, p-value: < 2.2e-16
#cart model